home *** CD-ROM | disk | FTP | other *** search
/ Risc World 3 / Risc World 3.iso / SOFTWARE / ISSUE2 / FASTERPC / DRIVE_C / GAMES / #IM / GRAPHICS / CGA / CGA.SRC < prev   
Text File  |  1993-05-02  |  3KB  |  91 lines

  1.          ; Test program for !FasterPC
  2.          ; Copyright D.J.Lawrence, 1993
  3.          ;
  4.          ; This test program loads a CGA mode 06 screen and scrolls
  5.          ; it vertically, as fast as it can. The program continues
  6.          ; until the screen has scrolled once or until the user
  7.          ; presses any key.
  8.  
  9. Code_Seg SEGMENT PUBLIC
  10.  
  11.          ASSUME CS:Code_Seg
  12.          ORG   00100H            ; Produce a '.COM' executable
  13.  
  14.          MOV   AX,0006H
  15.          INT   10H               ; Mode 06H (CGA 2 colours)
  16.  
  17.          ; Load picture file into video memory
  18.          PUSH  CS
  19.          POP   DS
  20.          MOV   AX,3D00H
  21.          MOV   DX,OFFSET PicName
  22.          INT   21H               ; Open picture file
  23.          MOV   FHandle,AX
  24.          MOV   BX,FHandle
  25.          MOV   AX,0B800H
  26.          PUSH  AX
  27.          POP   DS
  28.          MOV   AX,3F00H
  29.          MOV   CX,04000H         ; 16384 bytes to read
  30.          MOV   DX,0000H
  31.          INT   21H               ; Read picture file into video memory
  32.          MOV   BX,FHandle
  33.          MOV   AX,3E00H
  34.          INT   21H               ; Close picture file
  35.  
  36.          ; Perform the screen scroll for 200 pixels
  37.          ; or until the user presses a key
  38.          ; Initialise the 200 counter
  39.          MOV   BX,00C8H
  40.          ; First store the first half of screen memory
  41. UScroll: MOV   AX,0B800H
  42.          PUSH  CS
  43.          PUSH  AX
  44.          POP   DS                ; DS = B800
  45.          POP   ES                ; ES = CS
  46.          MOV   SI,0000H
  47.          MOV   DI,OFFSET DataArea
  48.          MOV   CX,0FA0H          ; Copy half screen (100 rows * 80 bytes = 4000 words)
  49.          REP   MOVSW
  50.          ; Next, copy the second half of the screen to the first half
  51.          PUSH  DS
  52.          POP   ES                ; ES = B800
  53.          MOV   SI,2000H
  54.          MOV   DI,0000H
  55.          MOV   CX,0FA0H
  56.          REP   MOVSW
  57.          ; Next, copy the first half back to the second shifted up by one row
  58.          PUSH  CS
  59.          POP   DS                ; DS = CS
  60.          MOV   SI,OFFSET DataArea
  61.          ADD   SI,0050H
  62.          MOV   DI,2000H
  63.          MOV   CX,0F78H          ; 99 rows * 80 bytes = 3960 words
  64.          REP   MOVSW
  65.          ; Finally, copy the first row to the last row
  66.          MOV   SI,OFFSET DataArea
  67.          MOV   CX,0028H          ; 1 row * 80 bytes = 40 words
  68.          REP   MOVSW
  69.  
  70.          ; See if the 200 rows have been completed
  71.          DEC   BX
  72.          CMP   BX,0000H
  73.          JE    Quit2
  74.          
  75.          ; See if user wants to exit
  76.          MOV   AX,0100H
  77.          INT   16H               ; Has a key has been pressed ?
  78.          JNE   Quit1             ; Yes - jump
  79.          JMP   UScroll           ; No  - continue scroll
  80. Quit1:   MOV   AX,0000H
  81.          INT   16H               ; Read the detected key
  82. Quit2:   MOV   AX,0003H
  83.          INT   10H               ; CGA mode 3 (80x25 colour text)
  84.          RET
  85.  
  86. FHandle  DW ?
  87. PicName  DB 'CGA.PIC',0
  88. DataArea DB 8192 DUP ?
  89.  
  90. Code_Seg ENDS
  91.